package cn03;

//字符串反转

import java.util.Scanner;

public class StringBuilderTest02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String line = sc.nextLine();

        //String--->StringBuilder(反转的方法 reverse)-->String
        StringBuilder sb = new StringBuilder(line);//String--->StringBuilder
        sb.reverse();//反转操作
        String s = sb.toString();//StringBuilder--->String
        System.out.println("s:" + s);
        //链式编程
        String s1 = new StringBuilder(line).reverse().toString();
        System.out.println(s1);

    }
}
